<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/extjs.jsp"%>
<html>
<head>
<%@include file="/common/meta.jsp" %>
<title></title>
<link rel="stylesheet" type="text/css" href="${ctx}/styles/style.css">
<link href="${ctx}/pages/longtian/order/css/order.css" rel="stylesheet" type="text/css">
</head>
<body>
	
<h6 align="center" style="margin-top: 30px;margin-bottom: 5px;">订单信息</h6>
<table  width="1000" border="0" cellpadding="0" cellspacing="0" align="center"  style="border: 2px solid #FCE6B2; ">			
	<tr class="title">
		<td align="center">订单号</td>
		<td>下单人</td>
		<td>订单总金额</td>			
		<td>订单状态</td>
		<td>下单时间</td>
	
	</tr>
	<tr>					
		<td align="center">${model.id }</td>
		<td>${model.user.name }</td>
		<td><fmt:formatNumber pattern="#,#00.00#">${model.money }</fmt:formatNumber></td>
		<td>
			<c:choose>
		         <c:when test="${model.status eq '0'}">
		         	待审核
		         </c:when>
		         <c:when test="${model.status eq '1'}">
		         	取消[系统]
		         </c:when>
		         <c:when test="${model.status eq '2'}">
		         	确认[未付款]
		         </c:when>
		         <c:when test="${model.status eq '3'}">
		         	已付款
		         </c:when>
		         <c:when test="${model.status eq '4'}">
		         	已发货
		         </c:when>
		         <c:when test="${model.status eq '5'}">
		         	结单
		         </c:when>
		         <c:when test="${model.status eq '6'}">
		         	取消[用户]
		         </c:when>
		         <c:when test="${model.status eq '7'}">
		         	系统删除
		         </c:when>
		     </c:choose>
		</td>
		<td><fmt:formatDate pattern="yyyy-MM-dd" value="${model.createDate}"></fmt:formatDate></td>
	
	</tr>
</table>
<h6 align="center" style="margin-top: 30px;margin-bottom: 5px;">订单明细</h6>
<table  width="1000" align="center" cellpadding="0" cellspacing="0"  style="border: 2px solid #FCE6B2; ">
	<tr class="title">
		<td align="center">NO.</td>
		<td>图片</td>
		<td>图书名称</td>
		<td>单价</td>
		<td>数量</td>
		<td>小计</td>				
	</tr>
		  <s:form id="frm" action="/front/orderForm" method="post">
  				<s:hidden name="model.id"></s:hidden>
  				<c:forEach items="${model.items}" var="itm" varStatus="status" >
					<tr class="cartTabelCell">
						<td>${status.index +1 }</td>
						<td>
							<a target="_blank"   	href="" 	name="productpic" title="">
    									<img src="${ctx}${itm.book.coverPhoto}"  style="width: 50px;height: 50px;" alt="22">
    								</a>
    							</td>
						<td>
							<a target="_blank"    	href="33"    	name="product" title="55">${itm.book.name }</a>
               				<input type="hidden" id="itemId${itm.id}" value="${itm.id }"></input>
              					<input type="hidden" name="itemId" id="itemId" value="${itm.id}"></input>
              				</td>
						<td>${itm.book.price }</td>
						<td>
							 <input type="hidden" id="count${itm.id}" value="${itm.count }"></input>                   
              					<%--onchange="modifyBookCount(${itm.key})" --%>    
              					${itm.count }    
               			</td>								
						<td><fmt:formatNumber pattern="#,#00.00#" value="${itm.money }"></fmt:formatNumber></td>
														
					</tr>
				</c:forEach>						
			</s:form>
</table>
	<table class="moneyTable" align="center">
		<tr>
			<td align="right"  style="border: 0">
				<p class="price">商品金额总计：<span class="moneyRenMinBi">￥<fmt:formatNumber pattern="#,#00.00#">${model.money}</fmt:formatNumber></span></p>
			</td>
		</tr>
		<tr>
			<td align="right" style="border: 0">
			 <c:if test="${model.status eq '0'}">
       			<input type="button" onclick="cancelOrder()" value="取消定单">
       		</c:if> 	
			</td>
		</tr>		
	</table>
      <c:if test="${param['placeOrderView'] != true}">
		<div  style="text-align: center;width: 80%">	
	    		<a href="javascript:history.back();">返回</a>
	    </div>
	  </c:if>  
     <form action="" id="removeFrm">
    	<input type="hidden" name="item.book.id" value=""></input>
    </form>
          <div class="clear"></div>
<script type="text/javascript">
function cancelOrder(){	
	Ext.MessageBox.confirm('提示','您确定取消订单?',function(btn){
		if(btn == 'yes'){
			var frm = document.getElementById("frm");
			frm.action = '${ctx}/front/orderForm/cancelOrder.do';
			frm.submit();
		}
	});
	//location.href = '${ctx}/login.jsp';


}
</script>
</body>
</html>